import React, { Fragment, useState } from "react";

function Alert() {
    let [num, setNum] = useState(0);
    const increment = () => {
        setNum(num => num += 1)
    }
    const decrement = () => {
        setNum(num => num -= 1)
    }
    return (
        <Fragment>
            <div className="mt-3 alert alert-danger">当前数值为：{num}</div>
            <button className="btn btn-primary" onClick={increment}>按钮</button>
            <button className="ml-3 btn btn-danger" onClick={decrement}>按钮</button>
        </Fragment>
    )
}

export default Alert